<template>
  <div id="app">
    <router-view />
  </div>
</template>
<script>
export default {
  created () {
    console.log("页面刷新")
    // 刷新页面时，重新连接websocket
    this.reConnectWebsocket();
  },
  methods: {
    reConnectWebsocket () {
      const userId = window.sessionStorage.getItem('userId');
      // console.log(userId)
      if (userId) {
        this.socketApi.initWebSocket(userId)
        //   console.log(userId)
      }
    }
  }
}
</script>
<style>
</style>
